home *** CD-ROM | disk | FTP | other *** search
- <%@ Language=VBScript CODEPAGE=65001 %>
- <!--#include file="include/wmsLocStrings.inc"-->
- <!--#include file="include/wmsServerHash.inc"-->
- <!--#include file="include/wmsPlugins.inc"-->
- <!--#include file="include/wmsHeader.inc"-->
- <!--#include file="include/wmsPageBanner.inc"-->
- <!--#include file="include/wmsError.inc"-->
- <%
- '+-------------------------------------------------------------------------
- '
- ' Microsoft Windows Media
- ' Copyright (C) Microsoft Corporation. All rights reserved.
- '
- ' File: ControlProtocolAdmin.asp
- '
- ' Contents:
- '
- '--------------------------------------------------------------------------
-
- ConnectToPlugin
- ConnectToPluginAdmin
-
- BeginErrorHandling
-
- Dim bDebugAllowAll
- Dim bDebugUseDefaultIP
- Dim szProtocolName
- Dim dwDefaultPort
- Dim bUsesDefaultPort
- Dim dwTabIndex
- Dim rgBoundIPAddrs
- Dim rgAvailIPAddrs
- Dim rgLen
-
- bDebugAllowAll = true
- bDebugUseDefaultIP = true
- dwTabIndex = 0
- bUsesDefaultPort = false
-
- szProtocolName = g_objPluginAdmin.ControlProtocol
- if( "" <> szProtocolName ) then
- if( 0 = StrComp( "MMS", szProtocolName, vbTextCompare ) ) then
- dwDefaultPort = 1755
- elseif( 0 = StrComp( "RTSP", szProtocolName, vbTextCompare ) ) then
- dwDefaultPort = 554
- elseif( 0 = StrComp( "HTTP", szProtocolName, vbTextCompare ) ) then
- dwDefaultPort = 80
- else
- dwDefaultPort = 0
- end if
- end if
-
- Dim strOp
- strOp = trim( posting( "submit" ) )
- if( 0 < Len( strOp ) ) then
- on error resume next
-
- Err.Clear
- Session( "ErrorNumber" ) = 0
-
- Dim strPort
- Dim dwPortNumber
- strPort = CStr( trim ( posting( "Port" ) ) )
- dwPortNumber = CDbl( trim( posting( "PortNumber" ) ) )
-
- err.number = 0
- if( 0 = err.number ) then
- if( 0 < Len( strPort ) ) then
- if( ( 0 = StrComp( "Default", strPort, vbTextCompare ) ) or ( dwDefaultPort = dwPortNumber ) )then
- if( dwDefaultPort <> g_objPluginAdmin.port ) then
- g_objPluginAdmin.port = dwDefaultPort
- end if
- else
- dwPortNumber = CDbl( posting( "portNumber" ) )
- if( 0 >= dwPortNumber ) or ( 65536 <= dwPortNumber )then
- Raise( -1 )
- err.description = RemoveDangerousCharacters( L_INVALIDPORTENTRY_TEXT )
- else
-
- if( g_objPluginAdmin.port <> dwPortNumber ) then
- if( ( 0 < dwPortNumber ) and ( 65535 >= dwPortNumber ) ) then
- g_objPluginAdmin.port = dwPortNumber
- end if
- end if
- end if
- end if
-
- if ErrorDetected( "Port" ) then
- Raise( -1 )
- end if
- end if
- end if
-
- if( "" <> posting("IPAddrMode") ) then
- if( "listenSelected" = trim( posting("IPAddrMode") ) ) then
-
- bDebugAllowAll = false
- if( g_objPluginAdmin.ListenAllIPAddresses ) then
- g_objPluginAdmin.ListenAllIPAddresses = FALSE
- end if
-
- Dim newIP
- Dim boundIPAddresses
- Dim availIPAddresses
- set boundIPAddresses = g_objPluginAdmin.BoundIPAddresses
- set availIPAddresses = g_objServer.AvailableIPAddresses
- boundIPAddresses.RemoveAll
- for i = 0 to ( posting( "numIPAddrs" ) - 1 )
- qskey = CStr( "IPAddr" & i )
-
- if( "" <> posting( CStr( qskey ) ) ) then
- newIP = availIPAddresses( i )
- end if
- if( "" <> newIP ) then
- boundIPAddresses.Add( newIP )
- end if
-
- if ErrorDetected( "SelectedIP" ) then
- Raise( -1 )
- exit for
- end if
-
- next
-
-
- else
- if( FALSE = g_objPluginAdmin.ListenAllIPAddresses ) then
- g_objPluginAdmin.ListenAllIPAddresses = TRUE
- end if
-
- if ErrorDetected( "AllIP" ) then
- Raise( -1 )
- end if
-
- end if
-
- end if
-
- if ( 0 = err.number ) then
- if( FALSE = IsEmpty( g_objPubPoint ) ) then
- Response.Redirect "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & g_strCategory & "&pluginIndex=" & qs("pluginIndex")
- else
- Response.Redirect "../server_props.asp?server=" & g_strQueryStringServer & "&category=" & g_strCategory & "&pluginIndex=" & qs("pluginIndex")
- end if
- end if
- else
- bDebugAllowAll = g_objPluginAdmin.ListenAllIPAddresses
- end if
-
- set rgBoundIPAddrs = g_objPluginAdmin.BoundIPAddresses
- set rgAvailIPAddrs = g_objServer.AvailableIPAddresses
- rgLen = rgAvailIPAddrs.Count
-
- if ( CDbl( dwDefaultPort ) = CDbl( g_objPluginAdmin.port ) ) then
- bUsesDefaultPort = true
- end if
-
-
- WriteHTMLHeader( g_strDecodedServerName )
- %>
- <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
- <% WritePluginJSUtils %>
- <script language="javascript">
- <!--
- /*@cc_on @*/
-
- var g_bUserAlertedToNaNEntry;
- var g_bUserAlertedToOutOfRangeEntry;
-
- g_bUserAlertedToNaNEntry = false;
- g_bUserAlertedToOutOfRangeEntry = false;
-
- ///////////////////////////////////////////////////////////////////////////
- function IsNaturalNumber( szValue )
- {
- <% jsTRY %>
- var dwNumber;
- var szNumber = szValue;
- var szConvertedNumber;
-
- var regExpTest = new RegExp( /^\d+$/gi );
- if( ! regExpTest.test( szValue ) )
- {
- return( false );
- }
- return( true );
-
- <% jsCATCH %>
- return( false );
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function IsValidPortNumber( szValue )
- {
- <% jsTRY %>
- if( ! IsNaturalNumber( szValue ) )
- {
- return( false );
- }
-
- var dwNumber = new Number( szValue );
- if( dwNumber > 65535 )
- {
- return( false );
- }
-
- if( dwNumber <= 0 )
- {
- return( false );
- }
-
- return( true );
- <% jsCATCH %>
- }
-
-
- ///////////////////////////////////////////////////////////////////////////
- function CanEnableOkButton()
- {
- <% jsTRY %>
- if( true == document.forms.pluginForm.portNumber.disabled )
- {
- if( true == document.forms.pluginForm.Port[ 0 ].checked )
- {
- document.forms.pluginForm.ok.disabled = false;
- }
- }
- <% jsCATCH %>
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function IsValidEntry()
- {
- <% jsTRY %>
- var dwPortNumber;
- var szPortEntry;
- var bValidNumber;
- var bInRange;
-
- if( document.forms.pluginForm.Port[ 0 ].checked )
- {
- document.forms.pluginForm.ok.disabled = false;
- return;
- }
-
- if( document.forms.pluginForm.portNumber.disabled )
- {
- document.forms.pluginForm.ok.disabled = true;
- return;
- }
-
- szPortEntry = new String( document.forms.pluginForm.portNumber.value );
- bValidNumber = true;
- bInRange = true;
-
- if( 0 == szPortEntry.length )
- {
- document.forms.pluginForm.portNumber.style.color="#000000";
- document.forms.pluginForm.ok.disabled = true;
- return;
- }
-
- if( ! IsNaturalNumber( szPortEntry ) )
- {
- bValidNumber = false;
- }
-
- if( bValidNumber )
- {
- bInRange = IsValidPortNumber( szPortEntry );
- }
-
- if( ! bValidNumber || ! bInRange )
- {
- document.forms.pluginForm.portNumber.style.color="#ff0000";
- document.forms.pluginForm.ok.disabled = true;
-
- if( ! bValidNumber && ( false == g_bUserAlertedToNaNEntry ) )
- {
- g_bUserAlertedToNaNEntry = true;
- window.alert( "<%= RemoveDangerousCharacters( L_INVALIDENTRY_TEXT ) %>" );
- }
-
- if( ! bInRange && ( false == g_bUserAlertedToOutOfRangeEntry ) )
- {
- g_bUserAlertedToOutOfRangeEntry = true;
- window.alert( "<%= RemoveDangerousCharacters( L_INVALIDPORTENTRY_TEXT ) %>" );
- }
- return;
- }
-
- document.forms.pluginForm.portNumber.style.color="#000000";
- document.forms.pluginForm.ok.disabled = false;
-
- CanEnableOkButton();
- <% jsCATCH %>
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function TogglePortRadioButtons( dwWhichButton )
- {
- <% jsTRY %>
- if( 0 == dwWhichButton )
- {
- document.forms.pluginForm.Port[0].checked = true;
- document.forms.pluginForm.Port[1].checked = false;
- document.forms.pluginForm.portNumber.disabled = true;
- CanEnableOkButton();
- }
- else
- {
- document.forms.pluginForm.Port[0].checked = false;
- document.forms.pluginForm.Port[1].checked = true;
- document.forms.pluginForm.portNumber.disabled = false;
- IsValidEntry();
- }
- <% jsCATCH %>
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function AssignToOtherPort()
- {
- <% jsTRY %>
- var theForm;
- var theElement;
- theForm = document.forms.controlProtocol;
- theElement = theForm.Port;
-
- document.forms.pluginForm.Port[0].checked = true;
- document.forms.pluginForm.Port[1].checked = false;
- document.forms.pluginForm.portNumber.value = "<%= dwDefaultPort %>";
- return;
- <% jsCATCH %>
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function ToggleIPAddressMode( dwWhichControl )
- {
- <% jsTRY %>
- if( 0 == dwWhichControl )
- {
- document.forms.pluginForm.IPAddrMode[ 0 ].checked = true;
- document.forms.pluginForm.IPAddrMode[ 1 ].checked = false;
- }
- else
- {
- document.forms.pluginForm.IPAddrMode[ 0 ].checked = false;
- document.forms.pluginForm.IPAddrMode[ 1 ].checked = true;
- }
-
- SetControlStates();
- <% jsCATCH %>
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function SetControlStates()
- {
- <% jsTRY %>
- var bEnableSpecificIPs;
- bEnableSpecificIPs = false;
-
- bEnableSpecificIPs = document.forms.pluginForm.IPAddrMode[ 1 ].checked;
-
- <% for iIP = 0 to ( rgLen - 1 ) %>
- document.forms.pluginForm.IPAddr<%= iIP %>.disabled = ! bEnableSpecificIPs;
- <% next %>
-
- document.forms.pluginForm.portNumber.disabled = ! document.forms.pluginForm.Port[1].checked;
- <% jsCATCH %>
- }
-
- ///////////////////////////////////////////////////////////////////////////
- function ToggleSpecifiedIPAddress( obj, bSimulated )
- {
- <% jsTRY %>
- if( ! obj )
- {
- return;
- }
-
- if( obj.disabled )
- {
- return;
- }
-
- if( bSimulated )
- {
- obj.checked = ! obj.checked;
- }
- <% jsCATCH %>
- }
- -->
- </script>
- </head>
- <body onload="JavaScript:SetControlStates();" class="pluginBody" oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
- <% DrawPluginBanner %>
- <table width=<%= Server.HTMLEncode( STDTABLEWIDTH ) %> >
- <tr>
- <td valign=top>
-
- <% WriteStdPluginForm %>
-
- <p>
- <table cellpadding=0 cellspacing=0 class="propgroupbox" width="80%">
- <caption align="left" class="pluginGroupHeader"><%= Server.HTMLEncode( L_IPADDRESSES_TEXT ) %></caption>
- <tr>
- <td width=10> </td>
- <td><% dwTabIndex = dwTabIndex + 1 %>
- <input
- type="radio"
- name="IPAddrMode"
- value="listenAll"
- onClick="JavaScript:ToggleIPAddressMode( 0 );"
- tabindex=<%= dwTabIndex %>
- id="allIP"
- <% if bDebugAllowAll then %>
- checked
- <% end if %> > <label for="allIP" class="defaultcursor"><% RenderWithErrorCheck Server.HTMLEncode( L_ALLOWALLIPADDRS_TEXT ), "AllIP" %></label>
- </td>
- </tr>
- <tr>
- <td width=10> </td>
- <td><% dwTabIndex = dwTabIndex + 1 %>
- <input
- type="radio"
- name="IPAddrMode"
- value="listenSelected"
- onClick="JavaScript:ToggleIPAddressMode( 1 );"
- tabindex=<%= dwTabIndex %>
- id="selectedIP"
- <% if not bDebugAllowAll then %>
- checked
- <% end if %> > <label for="selectedIP" class="defaultcursor"><% RenderWithErrorCheck Server.HTMLEncode( L_ALLOWSELECTEDADDRS_TEXT ), "SelectedIP" %></label>
- </td>
- </tr>
- <tr>
- <td width=10> </td>
- <td>
- <table border=0>
- <tr>
- <td width=30> </td>
- <td width=300 bgcolor="#FFFFFF">
- <table width=100% border=1 bordercolor="<%= Server.HTMLEncode( colorDialogDark ) %>">
- <tr>
- <td>
- <div class=normal>
- <%
- Dim rgAddresses
- Dim eachAddr
- Dim availAddr
- Dim boundAddr
- Dim szIPAddress
-
- i = 0
- eachElement = 0
- if( 0 <> rgLen ) then
- for each availAddr in rgAvailIPAddrs
-
- %><% dwTabIndex = dwTabIndex + 1 %>
- <input
- type="checkbox"
- name="IPAddr<%= i %>"
- value="on"
- tabindex=<%= dwTabIndex %> <%
-
- for each boundAddr in rgBoundIPAddrs
- if availAddr = boundAddr then
- Response.Write( " checked " )
- exit for
- end if
- next
-
- %> > <%
- %><span onClick="JavaScript:ToggleSpecifiedIPAddress( document.forms.pluginForm.IPAddr<%= i %>, true );" class="defaultcursor"><%= availAddr %></span><%
- if( 0 < i ) then
- Response.Write( vbNewLine )
- end if
-
- i = i + 1
- %><br><%
- next
- %><input type="hidden" name="numIPAddrs" value="<%= rgLen %>"><%
- end if
- %>
- </div>
- </td>
- </tr>
- </table>
- </td>
- <td width=10> </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
- <br>
-
- <table cellpadding=0 cellspacing=0 class="propgroupbox" width="80%">
- <caption align="left" class="pluginGroupHeader"><%= Server.HTMLEncode( L_PORTSELECTION_TEXT ) %></caption>
- <tr>
- <td width=10> </td>
- <td><% dwTabIndex = dwTabIndex + 1 %>
- <input
- type="radio"
- name="Port"
- value="Default"
- onClick="JavaScript:TogglePortRadioButtons( 0 );"
- onChange="JavaScript:IsValidEntry();"
- tabindex=<%= dwTabIndex %>
- id="defaultPort" <%
- if ( bUsesDefaultPort ) then %> checked <%
- end if %> onClick="JavaScript:TogglePortRadioButtons( 0 );" > <label for="defaultPort" class="defaultcursor"><%= Server.HTMLEncode( L_USEDEFAULTPORT_TEXT ) %> ( <%= CStr( dwDefaultPort ) %> )</label>
- </td>
- </tr>
-
- <tr>
- <td width=10> </td>
- <td><% dwTabIndex = dwTabIndex + 1 %>
- <input
- type="radio"
- name="Port"
- value="Other"
- onClick="JavaScript:TogglePortRadioButtons( 1 );"
- tabindex=<%= dwTabIndex %>
- id="customPort" <%
- if ( not bUsesDefaultPort) then %> checked <%
- end if %> > <label for="customPort" class="defaultcursor"><% RenderWithErrorCheck Server.HTMLEncode( L_USEOTHERPORTCOLON_TEXT ) & "<br>", "Port" %></label>
- </td>
- </tr>
-
- <tr>
- <td width=10> </td>
- <td>
- <table width=100% border=0>
- <tr>
- <td width=30> </td>
- <td><% dwTabIndex = dwTabIndex + 1 %>
- <input
- type="text"
- name="portNumber"
- size=6
- maxlength="5"
- tabindex=<%= dwTabIndex %>
- value="<%= Server.HTMLEncode( g_objPluginAdmin.Port ) %>"
- onKeyUp="JavaScript:TogglePortRadioButtons( 1 );"
- onChange="JavaScript:TogglePortRadioButtons( 1 );"
- onPaste="JavaScript:TogglePortRadioButtons( 1 );">
- <br>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td valign=bottom><% dwTabIndex = dwTabIndex + 1 %>
- <input type="submit" id="ok" align="baseline" tabIndex=<%= dwTabIndex %> value="<%= Server.HTMLEncode( L_OKAYBUTTON_TEXT ) %>">
- <% dwTabIndex = dwTabIndex + 1 %>
- <input type="button" id="cancel" align="baseline" name="cancel" onclick="JavaScript:Cancel()" tabIndex=<%= dwTabIndex %> value="<%= Server.HTMLEncode( L_CANCELBUTTONSPACED_TEXT ) %>">
- <% dwTabIndex = dwTabIndex + 1 %>
- <input type="button" id="help" align="baseline" name="help" onclick="JavaScript:DoPluginHelp( '<%
- if( 0 = strcomp( "HTTP", szProtocolName, vbTextCompare ) ) then
- Response.Write( H_HTTPCONTROLPROTHELPTOPIC )
- elseif( 0 = strcomp( "RTSP", szProtocolName, vbTextCompare ) ) then
- Response.Write( H_RTSPCONTROLPROTHELPTOPIC )
- elseif( 0 = strcomp( "MMS", szProtocolName, vbTextCompare ) ) then
- Response.Write( H_MMSCONTROLPROTHELPTOPIC )
- else
- Response.Write( H_MMSCONTROLPROTHELPTOPIC )
- end if
- %>' )" value="<%= Server.HTMLEncode( L_HELPBUTTONSPACED_TEXT ) %>" tabindex=<%= dwTabIndex %>>
- </td>
- </tr>
- </td>
- </tr>
- </form>
- </table>
- <%
- AlertUserWithPopupErrorDialog
- OnErrorGoBack
- DrawStdFooter
- %>
- </body>
- </html>
- <%
- LatchCurrentPage "plugins/ControlProtocolAdmin.asp", qs
- EndErrorHandling "ControlProtocolAdmin.asp"
-
- on error resume next
- PluginsASPCleanup
- %>
-